% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_boxplot_vs_ref.R
\name{plot_vs_us}
\alias{plot_vs_us}
\alias{plot_boxplot_vs_ref}
\title{Plot distribution of data among residents at sites vs reference area (US, etc.)}
\usage{
plot_vs_us(
  bysite = NULL,
  varname = "pctlowinc",
  type = "ggplot",
  refarealabel = "All Blockgroups Nationwide",
  siteslabel = "At Sites Analyzed",
  siteidlabel = NULL,
  refdata = NULL,
  nsample = 5000,
  fix_pctcols = TRUE,
  colorfills = c("lightblue", "yellow"),
  box.cex.ref = 0.6,
  box.cex.here = 2.2,
  box.pch.ref = 20,
  box.pch.here = 2,
  ...
)
}
\arguments{
\item{bysite}{table of results from ejamit()$results_bysite, like testoutput_ejamit_1000pts_1miles$results_bysite}

\item{varname}{name of column in bysite, like  "Demog.Index"}

\item{type}{"box", "plotly", or "ggplot"}

\item{refarealabel}{e.g., "All blockgroups in this State"}

\item{siteslabel}{e.g., "At Avg. Site Analyzed"}

\item{siteidlabel}{vector of text one per site to show if type 'box'}

\item{refdata}{reference area dataset, like blockgroupstats, but must have columns
named 'pop' and varname. e.g., refdata = blockgroupstats\link{ST \%in\% "DE", .(pop, pcthisp)}}

\item{nsample}{to limit dots on plot of ref area like all bg in US}

\item{colorfills}{two colors for boxplot}

\item{box.cex.ref}{use default}

\item{box.cex.here}{use default}

\item{box.pch.ref}{use default}

\item{box.pch.here}{description}

\item{...}{passed to boxplot()}
}
\value{
plots
}
\description{
Visualize indicator values (scores) as distributed across places
}
\details{
Not population weighted, so it is the distribution across sites not residents.

Could be edited to allow multiple types of sites and/or reference zones
more generally like for ejamit_compare_types_of_places()
}
\examples{
\dontrun{
  out <- testoutput_ejamit_1000pts_1miles
  # ejam2boxplot(out)
  # plot_boxplot_vs_ref(out$results_bysite)
  plot_vs_us(out$results_bysite, type = 'box')
  plot_vs_us(out$results_bysite, varname = "pctlingiso", type =  'box', ylim=c(0, 20))
  plot_vs_us(out$results_bysite, varname = "pctlingiso", type =  'ggplot')
  plot_vs_us(out$results_bysite, varname = "pctnhaa", type =  'ggplot')
  plot_vs_us(out$results_bysite, varname = "pctnhaa", type = 'box', ylim = c(0, 20))
  
 # td = testoutput_ejamit_1000pts_1miles$results_bysite
 # plot_vs_us(, type = 'box')
 # plot_vs_us(td, varname = "pctlingiso", type =  'box', ylim=c(0,20))
 # plot_vs_us(td, varname = "pctlingiso", type =  'ggplot')
 # plot_vs_us(td, varname = "pctnhaa", type =  'ggplot')
 # plot_vs_us(td, varname = "pctnhaa", type = 'box', ylim = c(0,20))
 # plot_vs_us(td[td$ST \%in\% "DE", ], 'pcthisp', refdata = blockgroupstats[ST \%in\% "DE", .(pop, pcthisp)])
  }
  
}
\seealso{
See \code{\link[=plot_boxplot_pctiles]{plot_boxplot_pctiles()}} for Percentile indicators compared in one plot.
and \code{\link[=boxplot_ratios]{boxplot_ratios()}} for an older Ratios plot.
See \code{\link[=ejam2barplot]{ejam2barplot()}}  for Ratio indicators compared in one plot.
See \code{\link[=plot_boxplot_vs_ref]{plot_boxplot_vs_ref()}} for a Raw indicator vs. a reference distribution.
}
\keyword{internal}
